/* 基础样式 */
.cell-input {
    width: 100%;
    height: 100%;
    text-align: center;
    font-size: 1.5rem;
    border: none;
    outline: none;
    background: transparent;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background: #333;
    border: 2px solid #333;
}

.cell {
    aspect-ratio: 1;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.cell:nth-child(9n) {
    border-right: none;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-message {
    color: #10B981; /* green-500 */
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #ECFDF5;
    border: 1px solid #10B981;
    display: inline-flex;
    align-items: center;
    margin: 0.25rem;
}

.error-message {
    color: #EF4444; /* red-500 */
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #FEF2F2;
    border: 1px solid #EF4444;
    display: inline-flex;
    align-items: center;
    margin: 0.25rem;
}

.info-message {
    color: #3B82F6; /* blue-500 */
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #EFF6FF;
    border: 1px solid #3B82F6;
    display: inline-flex;
    align-items: center;
    margin: 0.25rem;
}

.warning-message {
    color: #F59E0B; /* amber-500 */
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #FFFBEB;
    border: 1px solid #F59E0B;
    display: inline-flex;
    align-items: center;
    margin: 0.25rem;
}

/* 统一提示信息样式 */
.status-message {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-sizing: border-box;
    text-align: left;
    background-color: #f8f9fa; /* 统一背景色 */
}

/* 确保预览图片和网格尺寸一致 */
.preview-container, #sudokuBoard {
    width: 450px;
    height: 450px;
}

@media (max-width: 768px) {
    .preview-container, #sudokuBoard {
        width: 360px;
        height: 360px;
    }
}

@media (max-width: 480px) {
    .preview-container, #sudokuBoard {
        width: 270px;
        height: 270px;
    }
}

/* 响应式设计：平板和手机端缩小网格 */
@media (max-width: 1023px) {
    #sudokuBoard {
        width: 360px;
        height: 360px;
    }
    
    #sudokuBoard .cell {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    #sudokuBoard .cell input {
        font-size: 20px;
    }
    
    #previewImage {
        width: 360px;
        height: 360px;
    }
    
    #file-upload + label {
        width: 360px;
        height: 320px;
    }
}

@media (max-width: 767px) {
    #sudokuBoard {
        width: 270px;
        height: 270px;
    }
    
    #sudokuBoard .cell {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    #sudokuBoard .cell input {
        font-size: 16px;
    }
    
    #previewImage {
        width: 270px;
        height: 270px;
    }
    
    #file-upload + label {
        width: 270px;
        height: 240px;
    }
    
    .cell-input {
        font-size: 1.2rem;
    }
}

/* 确保选中单元格的样式 */
.cell:focus-within {
    background-color: #e6f3ff;
    outline: none;
}